package com.example.demo.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @auther sc
 * @Date 2017/10/30
 */
@FeignClient(name = "provide",fallback = FeignHystrix.class)
public interface FeignController {

    @RequestMapping("/hi")
    /***
     * get请求在feign客户端一定要加requestparam注解,否则参数会被放在body体内 当做post请求来做
     */
    @HystrixCommand(commandProperties ={
            @HystrixProperty(name="execution.isolation.strategy", value="SEMAPHORE"),
          //  @HystrixProperty(name="execution.isolation.thread.timeoutInMilliseconds", value = "5000")
    })
    public String hello(@RequestParam("name") String name);
}
